import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from 'path';


// const devProxyUrl = 'http://192.168.166.1:8083';  //本地

const devProxyUrl = 'http://paysys.theonelyq.cn:8083';  //线上环境
export default defineConfig({
  resolve: {
    //设置别名
    alias: {
        '@': path.resolve(__dirname, 'src')
    }
  },
  plugins: [vue()],
  server: {
    host: true,
    // 设置 https 代理
    proxy: {
      '/api': {
        target: devProxyUrl,
				changeOrigin: true,
				rewrite: (path) => {
					console.log(`请求${path}，代理到${devProxyUrl}${path}`);
					return path.replace(/^\/api/, '');
				}
      }
    }
  }
})
